<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<head>
<jsp:include page="/views/include.jsp"></jsp:include>
<script type="text/javascript">
	var contextPath = '<%=request.getContextPath()%>';
    $.parser.onComplete = function() {
		$('body').css('visibility','visible');
		setTimeout(function() {
			$('#loading-mask').remove();
		},50);
    };
</script>
</head>
<body style="margin: 0; padding: 0; height: 100%; overflow: hidden; background: #F2FBFF">
	<div id="mainlayout" class="easyui-layout" fit="true">
		<div region="north" border="false">
			<div class="toolbar">
				<table cellpadding="0" cellspacing="0" style="width: 95%;">
					<tr>
						<td><a href="javascript:newItem()" class="easyui-linkbutton" iconCls="icon-add" plain="true">新增</a> 
							<a href="javascript:editItem()" class="easyui-linkbutton" iconCls="icon-edit" plain="true">修改</a> 
							<a href="javascript:removeItem()" class="easyui-linkbutton" iconCls="icon-cancel" plain="true">删除</a> 
							<a href="javascript:refresh()" class="easyui-linkbutton" iconCls="icon-reload" plain="true">刷新</a> 
						</td>
					</tr>
				</table>
			</div>
		</div>
		<div region="center" border="false">
			<table id="dt-dataSource" class="easyui-datagrid" url="<c:url value='etl/dataSourcelistAll.tg'/>" fit="true" border="false" pagination="true" striped="true" singleSelect="true" rownumbers="true">
				<thead>
					<th field="dataSource_name" width="100" sortable="true">名称</th>
					<th field="dataSource_dialect" width="250">类型</th>
					<th field="dataSource_ip" width="100" sortable="true">IP</th>
					<th field="dataSource_port" width="100" sortable="true">端口</th>
					<th field="dataSource_dbname" width="100" sortable="true">数据库</th>
					<th field="dataSource_username" width="250">用户名</th>
					<th field="dataSource_password" width="250">密码</th>
				</thead>
			</table>
		</div>
		<!-- 新增数据源 start -->
		<div id="dataSource_add_dialog" class="easyui-dialog" closed="true" modal="true" buttons="#dataSource_add_dialog-buttons">
			<form id="dataSource_add_form" method="post">
				<div style="padding:20px">
					<table cellpadding="0" cellspacing="0" class="form-table">
						<tr>
							<td>数据源名称：</td>
							<td><input name="ds.dataSource_name" class="easyui-validatebox" style="width:200px" required="true"/></td>
						</tr>
						<tr>
							<td>IP地址：</td>
							<td><input id="s_dataSource_ip" name="ds.dataSource_ip" class="easyui-validatebox" style="width:200px" accept="number"/></td>
						</tr>
						<tr>
							<td>数据库类型：</td>
							<td>
								<select id="s_dataSource_dialect" name="ds.dataSource_dialect">
									<option value="0">MSSQLServer</option>
									<option value="1">MySQL</option>
									<option value="2">Oracle</option>
								</select>
							</td>
						</tr>
						<tr>
							<td>端口：</td><!-- ds.dataSource_port -->
							<td><input id="s_dataSource_port" name="ds.dataSource_port" class="easyui-validatebox" style="width:200px" /></td>
						</tr>
						<tr>
							<td>数据库：</td>
							<td><input id="s_dataSource_dbname" name="ds.dataSource_dbname" class="easyui-validatebox" style="width:200px" /></td>
						</tr>
						<tr>
							<td>用户名：</td>
							<td><input id="s_dataSource_username" name="ds.dataSource_username" class="easyui-validatebox" style="width:200px"/></td>
						</tr>
						<tr>
							<td>密码：</td>
							<td><input id="s_dataSource_password" name="ds.dataSource_password" class="easyui-validatebox" style="width:200px"/></td>
						</tr>
					</table>
				</div>
			</form>
			<div id="dataSource_add_dialog-buttons" style="text-align: center">
				<a href="#" class="easyui-linkbutton" iconCls="icon-save" onclick="checkConnection('save')">测试连接</a>
				<a href="#" class="easyui-linkbutton" iconCls="icon-save" onclick="saveItem()">保存</a> 
				<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dataSource_add_dialog').dialog('close')">关闭</a>
			</div>
		</div>
		<!-- 新增数据源 end -->
		
		<!-- 修改数据源 start -->
		<div id="dataSource_update_dialog" class="easyui-dialog" closed="true" modal="true" buttons="#dataSource_update_dialog-buttons">
			<form id="dataSource_update_form" method="post">
				<input type="hidden" id="dataSource_id" name="ds.dataSource_id">
				<div style="padding:20px">
					<table cellpadding="0" cellspacing="0" class="form-table">
						<tr>
							<td>数据源名称：</td>
							<td><input id="dataSource_name" name="ds.dataSource_name" class="easyui-validatebox" style="width:200px" required="true" /></td>
						</tr>
						<tr>
							<td>IP地址：</td>
							<td><input id="dataSource_ip" name="ds.dataSource_ip" class="easyui-validatebox" style="width:200px" /></td>
						</tr>
						<tr>
							<td>数据库类型：</td>
							<td>
								<select id="dataSource_dialect" name="ds.dataSource_dialect">
									<option value="0">MSSQLServer</option>
									<option value="1">MySQL</option>
									<option value="2">Oracle</option>
								</select>
							</td>
						</tr>
						<tr>
							<td>端口：</td>
							<td><input id="dataSource_port" name="ds.dataSource_port" class="easyui-validatebox" style="width:200px" /></td>
						</tr>
						<tr>
							<td>数据库：</td>
							<td><input id="dataSource_dbname" name="ds.dataSource_dbname" class="easyui-validatebox" style="width:200px" /></td>
						</tr>
						<tr>
							<td>用户名：</td>
							<td><input id="dataSource_username" name="ds.dataSource_username" class="easyui-validatebox" style="width:200px"/></td>
						</tr>
						<tr>
							<td>密码：</td>
							<td><input id="dataSource_password" name="ds.dataSource_password" class="easyui-validatebox" style="width:200px"/></td>
						</tr>
					</table>
				</div>
			</form>
			<div id="dataSource_update_dialog-buttons" style="text-align: center">
				<a href="#" class="easyui-linkbutton" iconCls="icon-save" onclick="checkConnection('update')">测试连接</a>
				<a href="#" class="easyui-linkbutton" iconCls="icon-save" onclick="updateItem()">保存</a> 
				<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dataSource_update_dialog').dialog('close')">关闭</a>
			</div>
		</div>
		<!-- 修改数据源 end -->
	</div>
</body>